<script setup>
import { useUserInfo } from '../stores/userInfo'
const store = useUserInfo()
const btnClick = () => {
  // store.user.name = '王五'
  store.$patch({
    user: {
      name: '赵六',
      age: 22
    }
  })
  // console.log(store.user.name)
}
</script>

<template>
  <div class="home-page">
    <h2>store使用：{{ store.user.name }}</h2>
    <h2>store的getters使用:{{ store.getName }}</h2>
    <button @click="store.setName">修改name</button>
    <button @click="btnClick">修改name</button>
    <h4>{{ store.user }}</h4>
    <hr />
    <h3>{{ store.stateNum }}</h3>
    <button @click="store.stateNum++">修改stateNum</button>
  </div>
</template>

<style scoped></style>
